package jt.classic.app.hys;

import java.util.List;
import java.util.Map;


public class Hys_Code {
    public static String SHZT_0 = "待审核";
    public static String SHZT_1 = "审核通过";
    public static String SHZT_2 = "未通过";

    public static String getSPZT(String num) {
        int code = Integer.parseInt(num);
        String result = "";

        switch (code) {
        case 0:
            result = Hys_Code.SHZT_0;

            break;

        case 1:
            result = Hys_Code.SHZT_1;

            break;

        case 2:
            result = Hys_Code.SHZT_2;
        }

        return result;
    }

    public static String getSPZT_HTML(String num, String hysyd_id) {
        int code = Integer.parseInt(num);
        String result = "";

        switch (code) {
        case 0:
            result = Hys_Code.SHZT_0 + "&nbsp;<a href=\"javascript:shenpi('" +
                hysyd_id + "')\";>审批</a>";

            break;

        case 1:
            result = Hys_Code.SHZT_1;

            break;

        case 2:
            result = Hys_Code.SHZT_2;
        }

        return result;
    }

    public static String getSPZT(String num, String hysyd_id) {
        int code = Integer.parseInt(num);
        String result = "";

        switch (code) {
        case 0:
            result = Hys_Code.SHZT_0;

            break;

        case 1:
            result = Hys_Code.SHZT_1;

            break;

        case 2:
            result = Hys_Code.SHZT_2 +
                "&nbsp;<a href=\"javascript:handleEdit1('" + hysyd_id +
                "')\";>重新提交</a>";
        }

        return result;
    }

    /**
     * 编辑，审核页面获得 会议室资源 下拉列表 html 代码 selcet
     * @param num  当前预定信息中的 会议室ID
     * @param hyszy  会议室资源列表
     * @param disabled true  置为不可用  false 可用
     * @return
     */
    public static String getHYS_select_HTML(String num, List hyszy,
        boolean disabled) {
        int code = Integer.parseInt(num);
        StringBuffer result = new StringBuffer();
        String sdisabled = (disabled) ? "disabled=disabled" : "";
        result.append("<select id=HYSYD_HYSID name=HYSYD_HYSID " + sdisabled +
            " >");

        if ((hyszy != null) && !hyszy.isEmpty()) {
            for (int i = 0; i < hyszy.size(); i++) {
                Map map = (Map) hyszy.get(i);
                String ID = map.get("HYS_ID").toString();
                String selected = ID.equals(num) ? "selected" : "";
                result.append("<option value=" + ID + " " + selected + " >");
                result.append(map.get("HYS_MC"));
                result.append("</option>");
            }
        }

        result.append("</select >");

        return result.toString();
    }

    /**
     * 编辑页面获得 会议室资源 名称 代码
     * 用于 查看预览 页面
     * @param num  当前预定信息中的 会议室ID
     * @param hyszy  会议室资源列表

     * @return
     */
    public static String getHYS_text_HTML(String num, List hyszy) {
        int code = Integer.parseInt(num);
        StringBuffer result = new StringBuffer();

        if ((hyszy != null) && !hyszy.isEmpty()) {
            for (int i = 0; i < hyszy.size(); i++) {
                Map map = (Map) hyszy.get(i);
                String ID = map.get("HYS_ID").toString();

                if (ID.equals(num)) {
                    result.append(
                        "<input type=text class='box3' name='HYSYD_HYSID_MC' id='HYSYD_HYSID_MC'  value='");
                    result.append(map.get("HYS_MC").toString());
                    result.append("' />");
                    result.append(
                        "<input type=hidden  name='HYSYD_HYSID' id='HYSYD_HYSID'  value='");
                    result.append(num);
                    result.append("' />");
                }
            }
        }

        return result.toString();
    }

    public static String getHYS_text(String num, List hyszy) {
        StringBuffer result = new StringBuffer();

        if ((hyszy != null) && !hyszy.isEmpty()) {
            for (int i = 0; i < hyszy.size(); i++) {
                Map map = (Map) hyszy.get(i);
                String ID = map.get("HYS_ID").toString();

                if (ID.equals(num)) {
                    result.append(map.get("HYS_MC").toString());
                }
            }
        }

        return result.toString();
    }
}
